﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Krile.Forms.ConfigForm.Children
{
    public partial class RenderArea : Krile.Kernel.Control.ConfigPage
    {
        public RenderArea()
        {
            InitializeComponent();
        }

        private void Renderer_Load(object sender, EventArgs e)
        {
            UserNameArea.Value = Core.Config.Appearance.Renderer.UserNameArea;
            widthSample.Width = (int)UserNameArea.Value;
            NormalListHeight.Value = Core.Config.Appearance.Renderer.Detail.NormalListHeight;
            SelectedListMinHeight.Value = Core.Config.Appearance.Renderer.Detail.SelectedListMinHeight;
            TextRenderingMargin.Value = Core.Config.Appearance.Renderer.Detail.TextRenderingMargin;
            this.ScrollbarWidth.Value = Core.Config.Appearance.ScrollbarWidth;
            ShowNormalStatusWithMultiline.Checked = Core.Config.Appearance.Renderer.Detail.ShowNormalStatusWithMultiline;
        }

        public override void Apply()
        {
            Core.Config.Appearance.Renderer.UserNameArea = (int)UserNameArea.Value;
            Core.Config.Appearance.ScrollbarWidth = (int)this.ScrollbarWidth.Value;
            Core.Config.Appearance.Renderer.Detail.NormalListHeight = (int)NormalListHeight.Value;
            Core.Config.Appearance.Renderer.Detail.SelectedListMinHeight = (int)SelectedListMinHeight.Value;
            Core.Config.Appearance.Renderer.Detail.TextRenderingMargin = (int)TextRenderingMargin.Value;
            Core.Config.Appearance.Renderer.Detail.ShowNormalStatusWithMultiline = ShowNormalStatusWithMultiline.Checked;
            base.Apply();
        }

        private void UserNameArea_ValueChanged(object sender, EventArgs e)
        {
            widthSample.Width = (int)UserNameArea.Value;
        }

    }
}
